package com.mornd.storage.service;

import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;

/**
 * @author: mornd
 * @dateTime: 2023/8/1 - 22:45
 */
public interface FileStorageService {

    /**
     * 上传
     * @param prefix
     * @param filename
     * @param contentType 文件类型，默认 application/octet-stream
     * @param inputStream
     * @return
     */
    String upload(String prefix, String filename, String contentType, InputStream inputStream) throws Exception;


    String upload(String prefix, String filename, MultipartFile file) throws Exception;

    /**
     * 删除文件
     *
     * @param pathUrl 文件全路径
     */
    void delete(String pathUrl) throws Exception;

    /**
     * 下载文件
     * @param pathUrl 文件全路径
     * @return
     */
    byte[] download(String pathUrl) throws Exception;

}
